package org.tigris.subversion.svnant.commands;

import java.io.File;
import java.io.IOException;
import java.util.Stack;
import org.tigris.subversion.svnant.SvnAntUtilities;
import org.tigris.subversion.svnclientadapter.ISVNClientAdapter;
import org.tigris.subversion.svnclientadapter.SVNClientException;
import org.tigris.subversion.svnclientadapter.SVNUrl;

public class Mkdir extends SvnCommand
{
  private static final String MSG_CANONICAL = "Cannot determine canonical path of %s";
  private static final String MSG_CANT_MAKE_DIRECTORY = "Can't make dir %s";
  private SVNUrl url = null;
  private File path = null;
  private String message = null;
  private boolean makeparents = false;

  public void execute()
  {
    if (this.url != null)
      try
      {
        getClient().mkdir(this.url, this.makeparents, this.message);
      }
      catch (SVNClientException localSVNClientException1)
      {
        throw ex(localSVNClientException1, "Can't make dir %s", new Object[] { this.url });
      }
    else
      try
      {
        if (this.makeparents)
        {
          try
          {
            this.path = this.path.getCanonicalFile();
          }
          catch (IOException localIOException)
          {
            throw ex(localIOException, "Cannot determine canonical path of %s", new Object[] { this.path });
          }
          Stack localStack = new Stack();
          while (!this.path.isDirectory())
          {
            localStack.push(this.path);
            this.path = this.path.getParentFile();
          }
          while (!localStack.isEmpty())
            getClient().mkdir((File)localStack.pop());
        }
        getClient().mkdir(this.path);
      }
      catch (SVNClientException localSVNClientException2)
      {
        throw ex(localSVNClientException2, "Can't make dir %s", new Object[] { this.path });
      }
  }

  protected void validateAttributes()
  {
    SvnAntUtilities.attrsNotSet("url, path", true, new Object[] { this.url, this.path });
    if (this.url != null)
      SvnAntUtilities.attrNotEmpty("message", this.message);
  }

  public void setUrl(SVNUrl paramSVNUrl)
  {
    this.url = paramSVNUrl;
  }

  public void setPath(File paramFile)
  {
    this.path = paramFile;
  }

  public void setMessage(String paramString)
  {
    this.message = paramString;
  }

  public void setMakeParents(boolean paramBoolean)
  {
    this.makeparents = paramBoolean;
  }
}

/* Location:           C:\Users\Administrator\Desktop\svnant.jar
 * Qualified Name:     org.tigris.subversion.svnant.commands.Mkdir
 * JD-Core Version:    0.6.0
 */